<?php
require(dirname(__FILE__)."/"."global.php");

if(!$step)
	$step = 1;


if($step == 1) {
	if(!$lfjuid)
		$lfjuid = 0;
	require(ROOT_PATH."inc/head.php");
	$userinfo;
	$query = $db->query("SELECT * FROM h_memberdata WHERE uid=$lfjuid");
	while($rs = $db->fetch_array($query)){
		$userinfo=$rs;
	}
	require(html("applyfor"));
} elseif($step == 2) {
	$apply_form = $db->get_one("select usetitle from h_form_module where id=14");
	if($apply_form['usetitle']==0) {
		showerr("扶持基金已关闭!");
	}
	
	if(!$lfjuid)
	showerr("请您先登录我们的网站!");
	
	$query = $db->query("SELECT * FROM h_form_content WHERE uid=$lfjuid and mid=14 ");
	if(!mysql_num_rows($query)) {
		
		if(!$company_name)
			showerr("公司名称不能为空!");
		if(!$address)
			showerr("地址不能为空!");
		if(!$contacter)
			showerr("联系人不能为空!");
		if(!$mobphone)
			showerr("电话不能为空!");
		if(!$email)
			showerr("邮箱不能为空!");
		if(!$site)
			showerr("网址不能为空!");
		if(!$yetai)
			showerr("请选择经营业态!");
		if(!$moshi)
			showerr("请选择经营模式!");
		if(!$is_info)
			showerr("请选择是否信息化!");
		if(!$info_key)
			showerr("请选择信息化建设重点!");
		if(!$want)
			showerr("请选择希望的支持!");
		if(!$hope)
			showerr("请选择预期的效果!");
	
		$r1 = "";
		foreach ($info_key as $value) {
  			$r1 .= "/$value";
		}
		$r2 = "";
		foreach ($want as $value) {
			$r2 .= "/$value";
		}
		$r3 = "";
		foreach ($hope as $value) {
			$r3 .= "/$value";
		}
		
		$db->query("insert into h_form_content (mid, posttime, list, uid, username) values 
										(14, '".time()."', '".time()."', $lfjuid, '$lfjid')");
		$id = $db->insert_id();
		
		$db->query("insert into h_form_content_14 (id, uid, company_name, address, contracter, phone,
					email, site, jingying_yetai, jingying_moshi, is_info, now_use,
					use_info, info_key, want, hope, other) 
						values 
							($id, $lfjuid, '$company_name', '$address', '$contacter', '$mobphone',
							 '$email', '$site', '$yetai', '$moshi', '$is_info', '$now_use',
							 '$use_info', '$r1', '$r2', '$r3', '$other')");
		
		showerr("您的申请已经提交!");
	} else {
		showerr("您不能重复申请!");
	}
}
require(ROOT_PATH."inc/foot.php");
?>
